const {db} = require('../util/util')

const getGrids = (nftId) => {
    sql = 'SELECT * FROM grid WHERE nftId = ?'
    return db.execute(sql, [nftId])
}
const addGrid = (grid) => {
    sql = 'INSERT INTO grid (x, y, idx, color, owner, nftId, createAt) VALUES (?, ?, ?, ?, ?, ?, ?)'
    return db.execute(sql, [grid.x, grid.y, grid.idx, grid.color, grid.owner, grid.nftId, Date.now()])
}

module.exports = {getGrids, addGrid}